package twoD.hofem.Q;

import inf.jlinalg.IMatrixReadOnly;

/**
 * A finite element.
 * 
 * @author Matthias Baitsch
 */
public abstract class Element {

	private MeshPart meshPart_;

	/**
	 * Creates this element.
	 * 
	 * @param meshPart
	 *            mesh part for this element
	 */
	public Element(MeshPart meshPart) {
		meshPart_ = meshPart;
	}

	/**
	 * Compute the element stiffness matrix.
	 * 
	 * @return k
	 */
	public abstract IMatrixReadOnly computeK();

	/**
	 * Returns the number of field functions for this element.
	 * 
	 * @return number of fields.
	 */
	public abstract int countFields();

	/**
	 * Returns the id of the specified field. Fields are defined in the
	 * {@link FieldInfo} class.
	 * 
	 * @param idx
	 *            index of the field
	 * @return field id
	 */
	public abstract int getFieldId(int idx);

	/**
	 * Returns the mesh part this element is associated with.
	 * 
	 * @return the mesh part.
	 */
	public MeshPart getMeshPart() {
		return meshPart_;
	}
}
